import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        navTitle: '', //标题内容
        navBack: false, //返回按钮
        loginStatus: localStorage.getItem('token') || false, //登录状态
        symbol: localStorage.getItem('symbol') || false,
        ZXgrade: localStorage.getItem('zxgrade'),
        SHgrade: localStorage.getItem('shgrade'),
        DFgrade: localStorage.getItem('dfgrade'),
        QXgrade: localStorage.getItem('qxgrade'),
    },
    mutations: {
        NAVTITLE(state, string) {
            state.navTitle = string
        },
        NAVBACK(state, bollean) {
            state.navBack = bollean
        },
        setRouting(state, loginStatus) {
            state.loginstatus = loginStatus
            localStorage.setItem('loginStatus', loginStatus)
        },
        SYMBOL(state, string) {
            state.symbol = string
            localStorage.setItem('symbol', string)
        },
        ZXGRADE(state, string) {
            state.grade = string
            localStorage.setItem('zxgrade', string)
        },
        SHGRADE(state, string) {
            state.grade = string
            localStorage.setItem('shgrade', string)
        },
        DFGRADE(state, string) {
            state.grade = string
            localStorage.setItem('dfgrade', string)
        },
        QXGRADE(state, string) {
            state.grade = string
            localStorage.setItem('qxgrade', string)
        },
    },
    actions: {},
})
